package weixinkeji.dev.power.view.tmp;

import com.alibaba.fastjson.JSON;
import java.util.ArrayList;
import java.util.List;
import sys.wx.components.io.IO;
import weixinkeji.dev.power.view.bean.PowerTree;

/**
 *
 * @author IK
 */
public class TPTService {

    private final List<PowerTree> list = new ArrayList<>();

    public void put(String id, String pid, String text) {
        list.add(new PowerTree(id, pid, text));
    }

    public void createJsonFile(String path) {
        IO.out(path, this.toJsonText());
    }

    public String toJsonText() {
        return JSON.toJSONString(list);
    }

}
